package com.eight.lotteryservice.controller;


import com.eight.lotteryservice.config.ResBean;
import com.eight.lotteryservice.entity.RedGame;
import com.eight.lotteryservice.mapper.RedGameMapper;
import com.eight.lotteryservice.service.RedGameService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author eight
 * @since 2022-08-20
 */
@RestController
@RequestMapping("/red-game")
@CrossOrigin
public class RedGameController {

    @Resource
    RedGameMapper redGameMapper;

    @GetMapping("games")
    ResBean gets(){
        ResBean resBean = new ResBean();
        resBean.setCode(1);
        resBean.setMsg("没有判断，全是正常");
        resBean.setData(redGameMapper.selectList(null));
        return resBean;
    }

    @PostMapping("gameByid")
    ResBean get(int gameid){
        ResBean resBean = new ResBean();
        resBean.setCode(1);
        resBean.setMsg("没有判断，全是正常");
        resBean.setData(redGameMapper.selectById(gameid));
        return resBean;
    }

    @PostMapping("deleteGame")
    void delete(int gameid){
        redGameMapper.deleteById(gameid);
    }

    @PostMapping("add")
    void add(RedGame redGame){
        redGameMapper.updateById(redGame);
    }


    @PostMapping("update")
    void update(RedGame redGame){
        redGameMapper.updateById(redGame);
    }





//    @GetMapping('games')
//

}

